<!DOCTYPE html >

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Pagination 分页表格</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	
    
    <script src="__PUBLIC__/scripts/boot.js" type="text/javascript"></script>
    
        
</head>
<body>
    <h1>项目列表</h1>      
 <div style="padding-bottom:8px;">
        <select id="select1" onchange="onStateChange(this.value)">
            <option value="所有" selected>所有</option>
            <option value="活跃">活跃</option>  
			<option value="休眠">休眠</option> 
			<option value="退出">退出</option> 
        </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        

 </div>  

<div id="datagrid1" class="mini-datagrid" style="width:800px;height:500px;" 
    url="__APP__/Project/query"  idField="id" allowResize="true"
    sizeList="[20,30,50,100]" pageSize="20"  showFilterRow="true" 
>
    <div property="columns">
        <div width="40" type="indexcolumn" >序号</div>
        <div field="pname" width="100" headerAlign="center" allowSort="true">项目名
            <input id="pnameFilter" property="filter" class="mini-textbox" onvaluechanged="onpnameFilterChanged" style="width:100%;" /></div>    
        <div field="managername" width="100" headerAlign="center" allowSort="true">项目经理
         <input id="managernameFilter" property="filter" class="mini-textbox" onvaluechanged="onmanagernameFilterChanged" style="width:100%;" /></div> 
		<div field="partnername" width="100" headerAlign="center" allowSort="true">主管合伙人
            <input id="partnernameFilter" property="filter" class="mini-textbox" onvaluechanged="onpartnernameFilterChanged" style="width:100%;" /></div> 		
        <div field="regdate" width="100" headerAlign="center"  allowSort="true" dateFormat="yyyy-MM-dd">入库日期</div>  
		<div field="fund" width="100" headerAlign="center"  allowSort="true">拟投基金主体
            <input id="fundFilter" property="filter" class="mini-textbox" onvaluechanged="onfundFilterChanged" style="width:100%;" /></div> 		
		<div field="postfund" width="150" headerAlign="center" >已投基金主体</div> 
        <div field="state" width="80" headerAlign="center"  allowSort="true">状态</div> 		
    </div>
</div>   


   
    <script type="text/javascript">
        mini.parse();       


        var grid = mini.get("datagrid1");
   
        grid.load({ state: "所有"});
		
		grid.on("rowclick", function (e) {
             //alert(e.record.mid);//弹个ID出来就好了
			 var url="__APP__/Project/toinfo?pid="+e.record.pid;
            window.parent.selectproject(url);
			//showWindow();
         });
		
      
		
		function showWindow() {
			var win = mini.get("win1");
			win.show();
		}
		function onStateChange(value) {   
			//mini.alert(value);
            grid.load({ state: value});
        }
        
        //对"createtime"字段，进行降级排序
        grid.sortBy("state", "desc");

        function search() {
            var key = document.getElementById("key").value;
			var state=document.getElementById("select1").value;
            grid.load({ pname: key, state:state});
        }
        $("#key").bind("keydown", function (e) {
            if (e.keyCode == 13) {
                search();
            }
        });
        ///////////////////////////////////////////////////////
		
	   function onmanagernameFilterChanged(e) {
        var textbox = e.sender;
        var key = textbox.getValue();
        var state=document.getElementById("select1").value;
        grid.load({ managername: key, state:state});
        }
        function onpartnernameFilterChanged(e) {
        var textbox = e.sender;
        var key = textbox.getValue();
        var state=document.getElementById("select1").value;
        grid.load({ partnername: key, state:state});
        }
         function onfundFilterChanged(e) {
        var textbox = e.sender;
        var key = textbox.getValue();
        var state=document.getElementById("select1").value;
        grid.load({ fund: key, state:state});
        }
         function onpnameFilterChanged(e) {
        var textbox = e.sender;
        var key = textbox.getValue();
        var state=document.getElementById("select1").value;
        grid.load({ pname: key, state:state});
        }
		
		
	
 		function CloseWindow(action) {

        if (window.CloseOwnerWindow) window.CloseOwnerWindow(action);

        else window.close();

    	} 

    </script>

    


  

</body>
</html>